package com.eascs.workflow.aging.controller;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.eascs.app.dao.PageResult;
import com.eascs.common.doc.excel.DefaultRowWriteHandler;
import com.eascs.common.doc.excel.ExcelApiHelper;
import com.eascs.common.exception.RuntimeIOException;
import com.eascs.common.util.IoUtil;
import com.eascs.common.util.StringUtil;
import com.eascs.common.util.UrlUtil;
import com.eascs.site.controller.BaseRestController;
import com.eascs.site.page.PaginationInfo;
import com.eascs.site.view.BaseRestResult;
import com.eascs.site.view.HtmlRestResult;
import com.eascs.site.view.PaginationRestResult;
import com.eascs.site.view.ViewContext;
import com.eascs.site.view.button.Button;
import com.eascs.site.view.button.ButtonHelper;
import com.eascs.workflow.aging.dubbo.AgingDubboServiceImpl;
import com.eascs.workflow.aging.form.AgingQueryForm;
import com.eascs.workflow.aging.form.NodeAgingForm;
import com.eascs.workflow.aging.form.ProcessAgingForm;
import com.eascs.workflow.aging.service.IAgingDevService;
import com.eascs.workflow.aging.service.IAgingService;
import com.eascs.workflow.aging.utils.IntToDate;
import com.eascs.workflow.common.entity.wf.DicData;
import com.eascs.workflow.common.vo.ModelResult;
import com.eascs.workflow.wf.service.TemplateService;

@RestController
@RequestMapping("/raging")
public class AgingInfoListRestController extends BaseRestController {

	@Autowired
	IAgingService agingService;

	@Autowired
	IAgingDevService agingDevService;

	@Autowired
	TemplateService templateService;

	@RequestMapping("/list")
	public PaginationRestResult list(AgingQueryForm entity) {
		String agingUrl = "/raging/list";
		if (entity != null) {
			String billCode = entity.getBillCode() == null ? "" : entity.getBillCode();
			String debtStatus = entity.getDebtStatus() == null ? "" : entity.getDebtStatus();
			String ltdName = entity.getLtdName() == null ? "" : entity.getLtdName();
			String timeOutType = entity.getTimeOutType() == null ? "" : entity.getTimeOutType();
			String orgManager = entity.getOrgManager() == null ? "" : entity.getOrgManager();
			String provinceCode = entity.getProvinceCode() == null ? "" : entity.getProvinceCode();
			String createDateStart = entity.getCreateDateStart() == null ? "" : entity.getCreateDateStart();
			String createDateEnd = entity.getCreateDateEnd() == null ? "" : entity.getCreateDateEnd();
			agingUrl = UrlUtil.appendUrl(agingUrl, "billCode", billCode);
			agingUrl = UrlUtil.appendUrl(agingUrl, "debtStatus", debtStatus);
			agingUrl = UrlUtil.appendUrl(agingUrl, "ltdName", ltdName);
			agingUrl = UrlUtil.appendUrl(agingUrl, "timeOutType", timeOutType);
			agingUrl = UrlUtil.appendUrl(agingUrl, "orgManager", orgManager);
			agingUrl = UrlUtil.appendUrl(agingUrl, "provinceCode", provinceCode);
			agingUrl = UrlUtil.appendUrl(agingUrl, "createDateStart", createDateStart);
			agingUrl = UrlUtil.appendUrl(agingUrl, "createDateEnd", createDateEnd);
			agingUrl = agingUrl + "&agingIndex=";
		} else {
			agingUrl = agingUrl + "?agingIndex=";
		}
		entity.setPageSize(10);
		PageResult<Object[]> agingInfoByPage = agingDevService.listAgingInfo(entity);
		entity.setPageSize(10);
		// if (StringUtil.isNotBlank(entity.getTimeOutType())) {
		// agingInfoByPage = OverData.getOverData(agingInfoByPage,
		// entity.getTimeOutType());
		// }
		agingInfoByPage = IntToDate.toDate(agingInfoByPage, 3, 7);
		String titles[] = { "单号", "经办人", "经营平台", "征信准入(超时)", "内部审批(超时)", "面签提报(超时)", "保证金管理费(超时)", "贷款单超时" };
		PaginationInfo paginationInfo = new PaginationInfo(agingInfoByPage, titles, agingUrl);
		Button roleManageButt = ButtonHelper.createRedirectButton("查看详情", "/aging/detail?billCode=");
		Button[] titleButton = new Button[] { roleManageButt };
		paginationInfo.setFirstRenderColumnIndex(0);
		paginationInfo.setMoreButtons(titleButton);
		paginationInfo.setRendTo("#aging_result");
		ViewContext.put("vo", entity);
		return PaginationRestResult.buildPaginationRestResult(paginationInfo);
	}

	@RequestMapping("/processDetail")
	public PaginationRestResult detail(String billCode, String processType) {
		PageResult<Object[]> agingDetail = agingService.getAgingDetail(billCode, processType);
		String[] titles = { "流程节点", "开始时间", "结束时间", "节点用时", "节点时效", "节点超时" };
		agingDetail = IntToDate.toDate(agingDetail, 3, 5);
		List<Object[]> data = agingDetail.getData();

		for (int i = 0, len = data.size(); i < len; i++) {
			if ("开始节点".equals(data.get(i)[0]) || "结束节点".equals(data.get(i)[0])) {
				for (int j = 1, len2 = data.get(i).length; j < len2; j++) {
					data.get(i)[j] = null;
				}
			}
		}

		PaginationInfo paginationInfo = new PaginationInfo(agingDetail, titles);
		paginationInfo.setBuildPagingNavigation(false);
		paginationInfo.setFirstRenderColumnIndex(0);
		ViewContext.put("paginationInfo", paginationInfo);
		return PaginationRestResult.buildPaginationRestResult(paginationInfo);
	}

	@Autowired
	AgingDubboServiceImpl agingDubboServiceImpl;

	@RequestMapping("/insert")
	public void insert() {
		agingDubboServiceImpl.insertLoanapply();
		System.out.println("sss");
	}

	@RequestMapping("/insert1")
	public void insert1() {
		agingDubboServiceImpl.insertWorkFlow();
		System.out.println("sss");
	}

	@RequestMapping("/insert2")
	public void insert2() {
		agingDubboServiceImpl.insertNode();
		System.out.println("sss");
	}

	@RequestMapping("/download")
	public void dowanload(AgingQueryForm param, HttpServletResponse httpServletResponse, HttpServletRequest request) {
		param.setPageSize(Integer.MAX_VALUE);
		PageResult<Object[]> pageResult = agingDevService.agingInfoList(param);
		String path = AgingInfoListRestController.class.getResource("/excelTemplate").getPath();
		StringBuffer s = new StringBuffer();
		String outPath = s.append(path).append("/aging-export.xls").toString();
		OutputStream os = null;
		try {
			String outfile = "时效资料导出数据.xls";
			String userAgent = request.getHeader("User-Agent");
			byte[] bytes = userAgent.contains("MSIE") ? outfile.getBytes() : outfile.getBytes("UTF-8");
			outfile = new String(bytes, "ISO-8859-1"); // 各浏览器基本都支持ISO编码
			File f = new File(outPath);
			if (!f.exists())
				throw new RuntimeIOException("file not found");
			os = httpServletResponse.getOutputStream();
			httpServletResponse.reset();
			httpServletResponse.setHeader("Content-Disposition", "attachment; filename=" + outfile);
			httpServletResponse.setContentType("application/octet-stream; charset=utf-8");
			DefaultRowWriteHandler defaultRowWriteHandler = new DefaultRowWriteHandler(pageResult.getData());
			defaultRowWriteHandler.setRowIndex(2);
			ExcelApiHelper.writeHandle(httpServletResponse.getOutputStream(),
					AgingInfoListRestController.class.getResourceAsStream("/excelTemplate/aging-export.xls"),
					defaultRowWriteHandler);
			ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
			IoUtil.fileToOutputStream(f, byteArrayOutputStream);
			os.write(byteArrayOutputStream.toByteArray());
			os.flush();
		} catch (IOException e) {
			throw new RuntimeIOException(e);
		} finally {
			IoUtil.close(os);
		}
	}

	@RequestMapping("/buildAgingExport")
	public void buildAging() {
		agingDubboServiceImpl.syncAgingExport();
	}

	/**
	 * 
	 * @Title: index
	 * @Description: 节点时效（结束流程）
	 * @author user
	 * @param entity
	 * @return
	 * @return String
	 * @throws @date
	 *             2017年9月21日 下午2:26:33
	 */
	@RequestMapping("/node_aging_list")
	public PaginationRestResult list(NodeAgingForm entity) {
		String agingUrl = "/raging/node_aging_list";
		entity.setPageSize(50);
		String billCode = entity.getBillCode() == null ? "" : entity.getBillCode();
		String catagory = entity.getCatagory() == null ? "" : entity.getCatagory();
		String processType = entity.getProcessType() == null ? "" : entity.getProcessType();
		String nodesNa = entity.getNodesNa() == null ? "" : entity.getNodesNa();
		String nodeAuditors = entity.getNodeAuditors() == null ? "" : entity.getNodeAuditors();
		String NodeTimeS = entity.getNodeTimeS() == null ? "" : entity.getNodeTimeS();
		String NodeTimeE = entity.getNodeTimeE() == null ? "" : entity.getNodeTimeE();
		String dateStart = entity.getDateStart() == null ? "" : entity.getDateStart();
		String dateEnd = entity.getDateEnd() == null ? "" : entity.getDateEnd();
		String nodeStatus = entity.getNodeStatus() == null ? "" : entity.getNodeStatus();
		String dateStartb = entity.getDateStartb() == null ? "" : entity.getDateStartb();
		String dateEndb = entity.getDateEndb() == null ? "" : entity.getDateEndb();

		agingUrl = UrlUtil.appendUrl(agingUrl, "billCode", billCode);
		agingUrl = UrlUtil.appendUrl(agingUrl, "catagory", catagory);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processType", processType);
		agingUrl = UrlUtil.appendUrl(agingUrl, "nodesNa", nodesNa);
		agingUrl = UrlUtil.appendUrl(agingUrl, "nodeAuditors", nodeAuditors);
		agingUrl = UrlUtil.appendUrl(agingUrl, "NodeTimeS", NodeTimeS);
		agingUrl = UrlUtil.appendUrl(agingUrl, "NodeTimeE", NodeTimeE);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateStart", dateStart);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateEnd", dateEnd);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateStartb", dateStartb);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateEndb", dateEndb);
		agingUrl = UrlUtil.appendUrl(agingUrl, "nodeStatus", nodeStatus);
		agingUrl = agingUrl + "&pageIndex=";
		// 构建流程类型数据
		if (StringUtils.isNotBlank(entity.getCatagory())) {
			List<DicData> dicList = templateService.getProcessTypeByCatagory(entity.getCatagory()).getModel();
			ViewContext.put("processTypeList", dicList);
			List<String> processTypeList = new ArrayList<String>();
			if (StringUtils.isNotBlank(entity.getProcessType())) {
				processTypeList.add(entity.getProcessType());
			} else {
				for (DicData dic : dicList) {
					processTypeList.add(dic.getCode());
				}
			}
			entity.setProcessTypeList(processTypeList);
		}
		PageResult<Object[]> agingInfoByPage = agingService.listNodeAgingInfo(entity);
		String titles[] = { "单号", "流程类型", "节点名称", "节点处理人", "节点开始时间", "节点结束时间", "节点用时/（小时）" };
		PaginationInfo paginationInfo = new PaginationInfo(agingInfoByPage, titles, agingUrl);
		Button showButton = ButtonHelper.createAjaxButton("查看详情", "/raging/agreeInfo?taskId=");
		Button[] titleButton = new Button[] { showButton };
		paginationInfo.setFirstRenderColumnIndex(1);
		paginationInfo.setMoreButtons(titleButton);
		paginationInfo.setRendTo("#node_aging_result");
		ViewContext.put("vo", entity);
		return PaginationRestResult.buildPaginationRestResult(paginationInfo);
	}

	/**
	 * 
	 * @Title: index
	 * @Description: 节点时效（未结束流程）
	 * @author user
	 * @param entity
	 * @return
	 * @return String
	 * @throws @date
	 *             2017年9月21日 下午2:26:33
	 */
	@RequestMapping("/node_aging_list2")
	public PaginationRestResult list2(NodeAgingForm entity) {
		String agingUrl = "/raging/node_aging_list2";
		entity.setPageSize(50);
		if (entity != null) {
			String billCode = entity.getBillCode() == null ? "" : entity.getBillCode();
			String catagory = entity.getCatagory() == null ? "" : entity.getCatagory();
			String processType = entity.getProcessType() == null ? "" : entity.getProcessType();
			String nodesNa = entity.getNodesNa() == null ? "" : entity.getNodesNa();
			String nodeAuditors = entity.getNodeAuditors() == null ? "" : entity.getNodeAuditors();
			String NodeTimeS = entity.getNodeTimeS() == null ? "" : entity.getNodeTimeS();
			String NodeTimeE = entity.getNodeTimeE() == null ? "" : entity.getNodeTimeE();
			String dateStart = entity.getDateStart() == null ? "" : entity.getDateStart();
			String dateEnd = entity.getDateEnd() == null ? "" : entity.getDateEnd();
			String nodeStatus = entity.getNodeStatus() == null ? "" : entity.getNodeStatus();
			String dateStartb = entity.getDateStartb() == null ? "" : entity.getDateStartb();
			String dateEndb = entity.getDateEndb() == null ? "" : entity.getDateEndb();

			agingUrl = UrlUtil.appendUrl(agingUrl, "billCode", billCode);
			agingUrl = UrlUtil.appendUrl(agingUrl, "catagory", catagory);
			agingUrl = UrlUtil.appendUrl(agingUrl, "processType", processType);
			agingUrl = UrlUtil.appendUrl(agingUrl, "nodesNa", nodesNa);
			agingUrl = UrlUtil.appendUrl(agingUrl, "nodeAuditors", nodeAuditors);
			agingUrl = UrlUtil.appendUrl(agingUrl, "NodeTimeS", NodeTimeS);
			agingUrl = UrlUtil.appendUrl(agingUrl, "NodeTimeE", NodeTimeE);
			agingUrl = UrlUtil.appendUrl(agingUrl, "dateStart", dateStart);
			agingUrl = UrlUtil.appendUrl(agingUrl, "dateEnd", dateEnd);
			agingUrl = UrlUtil.appendUrl(agingUrl, "dateStartb", dateStartb);
			agingUrl = UrlUtil.appendUrl(agingUrl, "dateEndb", dateEndb);
			agingUrl = UrlUtil.appendUrl(agingUrl, "nodeStatus", nodeStatus);
			agingUrl = agingUrl + "&pageIndex=";
			// 构建流程类型数据
			if (StringUtils.isNotBlank(entity.getCatagory())) {
				List<DicData> dicList = templateService.getProcessTypeByCatagory(entity.getCatagory()).getModel();
				ViewContext.put("processTypeList", dicList);
				List<String> processTypeList = new ArrayList<String>();
				if (StringUtils.isNotBlank(entity.getProcessType())) {
					processTypeList.add(entity.getProcessType());
				} else {
					for (DicData dic : dicList) {
						processTypeList.add(dic.getCode());
					}
				}
				entity.setProcessTypeList(processTypeList);
			}
		} else {
			agingUrl = agingUrl + "?pageIndex=";
		}
		PageResult<Object[]> agingInfoByPage = agingService.listNodeAgingInfo2(entity);
		String titles[] = { "单号", "流程类型", "节点名称", "节点处理人", "节点开始时间", "节点结束时间", "节点用时/（小时）"};
		PaginationInfo paginationInfo = new PaginationInfo(agingInfoByPage, titles, agingUrl);
		Button showButton = ButtonHelper.createAjaxButton("查看详情", "/raging/agreeInfo?taskId=");
		Button[] titleButton = new Button[] { showButton };
		paginationInfo.setFirstRenderColumnIndex(1);
		paginationInfo.setMoreButtons(titleButton);
		paginationInfo.setRendTo("#node_aging_result2");
		ViewContext.put("vo", entity);
		return PaginationRestResult.buildPaginationRestResult(paginationInfo);
	}

	/**
	 * 根据流程种类获取流程类型
	 * 
	 * @param catagory
	 * @return
	 */
	@RequestMapping(value = "/wf/getProccessType", method = RequestMethod.GET)
	public BaseRestResult<List<DicData>> getProcessTypeByCatagory(@RequestParam("catagory") String catagory) {
		List<DicData> data = new ArrayList<DicData>();
		if (StringUtil.hasText(catagory)) {
			ModelResult<List<DicData>> modelResult = templateService.getProcessTypeByCatagory(catagory);
			data = modelResult.getModel();
		}
		return BaseRestResult.buildRestResult(data);
	}

	@RequestMapping("/agreeInfo")
	public HtmlRestResult taskDetail(String taskId) {
		ViewContext.put("agreeUrl", "/wf/processNode/nodeList?taskId=" + taskId);
		return HtmlRestResult.popHtmlFragment("aging/nodeAgingDetail");
	}

	/**
	 * 
	 * @Title: index
	 * @Description:流程时效（未结束流程）
	 * @author user
	 * @param entity
	 * @return
	 * @return String
	 * @throws @date
	 *             2017年9月21日 下午2:26:33
	 */
	@RequestMapping("/process_aging_list")
	public PaginationRestResult process_aging_list(ProcessAgingForm entity) {
		String agingUrl = "/raging/process_aging_list";
		entity.setPageSize(50);
		String billCode = entity.getBillCode() == null ? "" : entity.getBillCode();
		String catagory = entity.getCatagory() == null ? "" : entity.getCatagory();
		String processType = entity.getProcessType() == null ? "" : entity.getProcessType();
		String processTimeS = entity.getProcessTimeS() == null ? "" : entity.getProcessTimeS();
		String processTimeE = entity.getProcessTimeE() == null ? "" : entity.getProcessTimeE();
		String dateStart = entity.getDateStart() == null ? "" : entity.getDateStart();
		String dateEnd = entity.getDateEnd() == null ? "" : entity.getDateEnd();
		String dateStartb = entity.getDateStartb() == null ? "" : entity.getDateStartb();
		String dateEndb = entity.getDateEndb() == null ? "" : entity.getDateEndb();
		String processStatus = entity.getProcessStatus() == null ? "" : entity.getProcessStatus();
		String province = entity.getProvince() == null ? "" : entity.getProvince();
		agingUrl = UrlUtil.appendUrl(agingUrl, "billCode", billCode);
		agingUrl = UrlUtil.appendUrl(agingUrl, "catagory", catagory);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processType", processType);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processTimeS", processTimeS);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processTimeE", processTimeE);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateStart", dateStart);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateEnd", dateEnd);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processStatus", processStatus);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateStartb", dateStartb);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateEndb", dateEndb);
		agingUrl = UrlUtil.appendUrl(agingUrl, "province", province);
		agingUrl = agingUrl + "&pageIndex=";
		// 构建流程类型数据
		if (StringUtils.isNotBlank(entity.getCatagory())) {
			List<DicData> dicList = templateService.getProcessTypeByCatagory(entity.getCatagory()).getModel();
			ViewContext.put("processTypeList", dicList);
			List<String> processTypeList = new ArrayList<String>();
			if (StringUtils.isNotBlank(entity.getProcessType())) {
				processTypeList.add(entity.getProcessType());
			} else {
				for (DicData dic : dicList) {
					processTypeList.add(dic.getCode());
				}
			}
			entity.setProcessTypeList(processTypeList);
		}
		PageResult<Object[]> agingInfoByPage = agingService.listProcessAgingInfo(entity);
		String titles[] = { "单号", "省区", "流程类型", "流程开始时间", "流程结束时间", "流程用时/（小时）" };
		PaginationInfo paginationInfo = new PaginationInfo(agingInfoByPage, titles, agingUrl);
		Button showButton = ButtonHelper.createAjaxButton("查看详情", "/raging/agreeInfo?taskId=");
		Button[] titleButton = new Button[] { showButton };
		paginationInfo.setFirstRenderColumnIndex(1);
		paginationInfo.setMoreButtons(titleButton);
		paginationInfo.setRendTo("#process_aging_result");
		ViewContext.put("vo", entity);
		return PaginationRestResult.buildPaginationRestResult(paginationInfo);
	}

	/**
	 * 
	 * @Title: index
	 * @Description:流程时效（结束流程）
	 * @author user
	 * @param entity
	 * @return
	 * @return String
	 * @throws @date
	 *             2017年9月21日 下午2:26:33
	 */
	@RequestMapping("/process_aging_list2")
	public PaginationRestResult process_aging_list2(ProcessAgingForm entity) {
		String agingUrl = "/raging/process_aging_list2";
		entity.setPageSize(50);
		String billCode = entity.getBillCode() == null ? "" : entity.getBillCode();
		String catagory = entity.getCatagory() == null ? "" : entity.getCatagory();
		String processType = entity.getProcessType() == null ? "" : entity.getProcessType();
		String processTimeS = entity.getProcessTimeS() == null ? "" : entity.getProcessTimeS();
		String processTimeE = entity.getProcessTimeE() == null ? "" : entity.getProcessTimeE();
		String dateStart = entity.getDateStart() == null ? "" : entity.getDateStart();
		String dateEnd = entity.getDateEnd() == null ? "" : entity.getDateEnd();
		String dateStartb = entity.getDateStartb() == null ? "" : entity.getDateStartb();
		String dateEndb = entity.getDateEndb() == null ? "" : entity.getDateEndb();
		String processStatus = entity.getProcessStatus() == null ? "" : entity.getProcessStatus();
		agingUrl = UrlUtil.appendUrl(agingUrl, "billCode", billCode);
		agingUrl = UrlUtil.appendUrl(agingUrl, "catagory", catagory);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processType", processType);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processTimeS", processTimeS);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processTimeE", processTimeE);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateStart", dateStart);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateEnd", dateEnd);
		agingUrl = UrlUtil.appendUrl(agingUrl, "processStatus", processStatus);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateStartb", dateStartb);
		agingUrl = UrlUtil.appendUrl(agingUrl, "dateEndb", dateEndb);
		agingUrl = agingUrl + "&pageIndex=";
		// 构建流程类型数据
		if (StringUtils.isNotBlank(entity.getCatagory())) {
			List<DicData> dicList = templateService.getProcessTypeByCatagory(entity.getCatagory()).getModel();
			ViewContext.put("processTypeList", dicList);
			List<String> processTypeList = new ArrayList<String>();
			if (StringUtils.isNotBlank(entity.getProcessType())) {
				processTypeList.add(entity.getProcessType());
			} else {
				for (DicData dic : dicList) {
					processTypeList.add(dic.getCode());
				}
			}
			entity.setProcessTypeList(processTypeList);
		}
		PageResult<Object[]> agingInfoByPage = agingService.listProcessAgingInfo2(entity);
		String titles[] = { "单号", "省区", "流程类型", "流程开始时间", "流程结束时间", "流程用时/（小时）" };
		PaginationInfo paginationInfo = new PaginationInfo(agingInfoByPage, titles, agingUrl);
		Button showButton = ButtonHelper.createAjaxButton("查看详情", "/raging/agreeInfo?taskId=");
		Button[] titleButton = new Button[] { showButton };
		paginationInfo.setFirstRenderColumnIndex(1);
		paginationInfo.setMoreButtons(titleButton);
		paginationInfo.setRendTo("#process_aging_result2");
		ViewContext.put("vo", entity);
		return PaginationRestResult.buildPaginationRestResult(paginationInfo);
	}
}
